import {
  Controller,
  Post,
  Body,
  Get,
  Param,
  Req,
  HttpException,
  HttpStatus,
  Delete,
} from '@nestjs/common';
import Redis from 'ioredis';
import { InjectRedis } from '@nestjs-modules/ioredis';
import { ApiExcludeController, ApiTags } from '@nestjs/swagger';

import { JwtPass } from '@/core/decorator';
import { TestService } from './test.service';

@ApiExcludeController()
@ApiTags('通用/测试')
@Controller('test')
export class TestController {
  constructor(
    private readonly testService: TestService,
    @InjectRedis() private readonly redis: Redis,
  ) {}

  /**
   * 用户创建
   */
  @Post()
  @JwtPass()
  async createUser() {
    await this.testService.create();
  }

  /**
   * 删除用户
   */
  @Delete('user/:userId')
  @JwtPass()
  async deleteUser(@Param('userId') userId: number) {
    await this.testService.removeUser(userId);
  }

  /**
   * 删除信息
   */
  @Delete('message/:messageId')
  @JwtPass()
  async deleteInfo(@Param('messageId') messageId: number) {
    await this.testService.removeMessage(messageId);
  }

  /**
   * 用户详情
   */
  // @Get(':userId')
  // async userDetail(userId: number): Promise<UserDetailDto> {
  //   return this.userService.findOne(userId);
  // }
}
